<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

<title>增加用户</title>
<link rel="stylesheet" href="css/common.css" type="text/css" />
<link href="css/adminstyle.css" rel="stylesheet" type="text/css">
<script src="js/jquery-1.6.2.min.js"></script>
</head>

<script>

var select2 = new Array(<?=count($departmentList)?>);
<?
foreach($departmentList as $k=>$v){
?>
select2[<?=$k?>] = new Array();
select2[<?=$k?>][0] = new Option("请选择", "-1");
<?
foreach($employees[$k] as $k1=>$v1){
?>
	select2[<?=$k?>][<?=$k1+1?>] = new Option("<?=$v1['name']?>", "<?=$v1['id']?>");
<?
	}
}

?>

function redirec(x,dx,city){

	var temp = dx; 

	temp.options.length=0;

	for (i=0;i<select2[x].length;i++){

		temp.options[i]=new Option(select2[x][i].text,select2[x][i].value);

		if (city>0){

			if (select2[x][i].value==city){

				temp.options[i].selected=true;

			}

		}

	}

}

</script>

<body>
<div id="man_zone">
<table width="98%" border="0" align="center" cellpadding="3" cellspacing="1" class="tableborder" style="margin-top:8px;">

  <form  method="post" id="form1" action="<? if  (intval($id)>0){ echo  'admin_subUpdate.html'; }else{ echo  'admin_subAdd.html'; }  ?>" >

  <input name="id" type="hidden" value="<?=$id?>">

    <tr bgcolor="#FFFFFF"> 

      <td height="25" width="246"  class="left_title_2adminssd">用户名称<?=$id?></td>

      <td width="1045" height="25"> 

      <?

      if (intval($id)>0){

	  	echo $name;  ?>

        <input name="name" type="hidden" value="<?=$name?>">

		<?

	  }

	  else{ 

	  	?>

      	<input name="name" type="text"  size="60" value=""> 

      	<?

	     }

		?>

      </td>

    </tr>



       <tr bgcolor="#FFFFFF"> 

      <td height="25"  class="left_title_2adminssd">密码(不想修改密码时不用填)<?php echo Common::_t('page_select');?></td>

      <td height="25"> <input name="password" type="password" size="30"  value=""> 

      </td>

    </tr>

      <tr bgcolor="#FFFFFF"> 

	      <td height="25"  class="left_title_2adminssd">组别</td>

	      <td height="25">

	      <select name="eo_admin_group">

	      <?

	      foreach ($functoinList as $v){

		  	?>

	        <option value="<?=$v['id']?>" <? if (isset($eo_admin_group)) { if ($eo_admin_group==$v['id']){ echo 'selected'; } } ?>><?=$v['name']?></option>

	        <?

		  }

		  ?>

	      </select>

	      </td>

	   </tr>

      <tr bgcolor="#FFFFFF"> 

      <td height="25"  class="left_title_2adminssd">状态</td>

      <td height="25">

      <select name="status">

        <option value="1" <?  if (isset($eo_admin_group)) { if  ($status==1){ echo 'selected'; }}  ?>>可用</option>

    <option value="2" <?  if (isset($eo_admin_group)) { if ($status==2){ echo 'selected'; }}  ?>>不可用</option>

      </select>

      </td>

    </tr>

    

   <tr bgcolor="#FFFFFF"> 

      <td height="25"  class="left_title_2adminssd">类别<?=getParamValue('admin_type')?></td>

      <td height="25">

       <?=page_modifier_radios('admin_type',$page_admintype_radios,getStr($extract_vars,'admin_type',ADMIN_TYPE_TEACHER))?></td>

    </tr>   

    

     <tr bgcolor="#FFFFFF" id="tr_employee"  style="display:none"> 

      <td height="25"  class="left_title_2adminssd">关联员工</td>

      <td height="25">部门&nbsp;&nbsp;&nbsp;

      <select name="dept_id" id="dept_id"  onChange="redirec(this.value,document.getElementById('employee_id'))"   >

        <option value="-1">请选择</option>

          <?

          foreach ($departmentList as $k=>$v){

		  ?>

       	   <option value="<?=$k?>"  <?  if (isset($dept_id)){ if ($dept_id==$k){ echo 'selected="selected"';   } } ?> ><?=$v?></option>

          <?

		  }

		  ?>

      </select>

               员工&nbsp;&nbsp;&nbsp;

      <select name="employee_id" id="employee_id" >

      </select>

      <script>

		<?

		if (!empty($dept_id)){?>

			redirec(document.getElementById('dept_id').value,document.getElementById('employee_id'),<?=$employee_id?>);

		 <?	

		 }

		?>

	</script>

     </td>

    </tr>

    

    <tr bgcolor="#FFFFFF" id="tr_teacher" style="display:''"> 

      <td height="25"  class="left_title_2adminssd">关联教师</td>

      <td height="25"><select name="teacher_id"  >

        <option value="-1">请选择</option>

          <?

          foreach ($teacher as $v){

		  ?>

        <option value="<?=$v['id']?>"  <?  if (isset($teacher_id)){  if ($v['id']==$teacher_id){ echo 'selected="selected"';   }} ?> ><?=$v['serial_number'].'-'.$v['name']?></option>

        <?

		  }

		?>

      </select>
  </td>

    <tr bgcolor="#FFFFFF" id="tr_funduser" style="display:''"> 

      <td height="25"  class="left_title_2adminssd">基金用户</td>

      <td height="25"><select name="fund_user_id"  >

        <option value="-1">请选择</option>

          <?=$page_funduser_options?>

      </select>
  </td>

    </tr>

    <tr bgcolor="#FFFFFF"> 

      <td height="25"  class="left_title_2adminssd">默认语言</td>

      <td height="25">

      <select name="default_language">

		<?=$defaultLanguageOption?>

      </select>

      </td>

    </tr>

    

    

    <tr bgcolor="#FFFFFF"> 

      <td height="25">&nbsp;</td>

      <td height="25" align="center"><input type="submit" class="PublicBot" name="submit" value="提交"> <input type="reset" class="PublicBot" name="Submit2" value="重置">

        <input name="input" type="button" class="PublicBot" value="返回" onclick="window.history.go(-1);" />

              </td>

    </tr>

	</form>



  </table>
</div>
<script>
var admin_type =<?=getStr($extract_vars, 'admin_type',ADMIN_TYPE_TEACHER)=='0'?ADMIN_TYPE_TEACHER:getStr($extract_vars, 'admin_type')?>;

$(document).ready(

	    function()

	   {

		if(admin_type=='<?=ADMIN_TYPE_TEACHER?>'){

			$("#tr_teacher").css("display",'');
			$("#tr_employee").css("display",'none');
			$("#tr_funduser").css("display",'none');

		}	

		if(admin_type=='<?=ADMIN_TYPE_EMPLOYEE?>'){

			$("#tr_funduser").css("display",'none');
			$("#tr_teacher").css("display",'none');
			$("#tr_employee").css("display",'');

		}	
		
		if(admin_type=='<?=ADMIN_TYPE_FUNDUSER?>'){

			$("#tr_funduser").css("display",'');
			$("#tr_teacher").css("display",'none');
			$("#tr_employee").css("display",'none');

		}	

	   }

);

   

	   	

$("input:radio[name=admin_type]").click(function(){

	if($('input:radio[name=admin_type]:checked').val()=='<?=ADMIN_TYPE_TEACHER?>'){

		$("#tr_teacher").css("display",'');

		$("#tr_employee").css("display",'none');

		$("#tr_funduser").css("display",'none');

	};

	if($('input:radio[name=admin_type]:checked').val()=='<?=ADMIN_TYPE_EMPLOYEE?>'){

		$("#tr_teacher").css("display",'none');

		$("#tr_employee").css("display",'');

		$("#tr_funduser").css("display",'none');

	};

	if($('input:radio[name=admin_type]:checked').val()=='<?=ADMIN_TYPE_FUNDUSER?>'){

		$("#tr_teacher").css("display",'none');

		$("#tr_employee").css("display",'none');

		$("#tr_funduser").css("display",'');

	};

})



</script>
</body>



</html>

